package Widget

import "github.com/lxn/walk/declarative"

type XForm struct {
	Sprite    *declarative.Composite
	TitleText *declarative.Label
	LineEdit  *declarative.LineEdit
}

func (m *XForm) SetTitleText(txt string) {
	m.TitleText.Text = txt
	//m.Composite.Children = append(m.Composite.Children, )
}

func (m *XForm) SetLineEdit(txt string) {
	m.LineEdit.Text = txt
	//m.Composite.Children = append(m.Composite.Children, )
}

func CreateMainForm() *XForm {
	f := &XForm{
		Sprite: &Composite{
			Layout:   declarative.Grid{Columns: 2},
			Children: []declarative.Widget{
				//declarative.Label{
				//	Text: "                        主窗口信息：",
				//},
				//declarative.LineEdit{
				//	MaxSize:  declarative.Size{Width: 150, Height: 40},
				//	Text:     "这是主窗口",
				//	ReadOnly: true,
				//},
			},
		},
	}
	label := &declarative.Label{
		//Text: "                        主窗口信息：",
	}
	f.Sprite.Children = append(f.Sprite.Children, label)
	f.TitleText = label

	edit := &declarative.LineEdit{
		MaxSize: declarative.Size{Width: 150, Height: 40},
		//Text:     "这是主窗口",
		ReadOnly: true,
	}
	f.Sprite.Children = append(f.Sprite.Children, edit)
	f.LineEdit = edit
	return f
}
